﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HTTPServerLib;
using HttpServer;

namespace HTTPServerLib
{
    class Program
    {
        static void Main(string[] args)
        {
            ExampleServer server = new ExampleServer("0.0.0.0", 4050);
            server.SetRoot(@"F:\git\HttpServer\HTTPServer\HTTPServer\bin\Debug\web");
            server.Logger = new ConsoleLogger();

            server.AddPath("/game/open",gameOpen);
            server.AddPath("/game/close", gameClose);

            server.Start();
        }

        public static void gameOpen(HttpRequest request, HttpResponse response)
        {
            response.SetContent("{gameOpen}");
            response.Content_Encoding = "utf-8";
            response.StatusCode = "200";
            response.Content_Type = "text/html; charset=UTF-8";
            response.Headers["Server"] = "ExampleServer";

            //发送响应
            response.Send();
        }
        public static void gameClose(HttpRequest request, HttpResponse response)
        {
            response.SetContent("{gameClose}");
            response.Content_Encoding = "utf-8";
            response.StatusCode = "200";
            response.Content_Type = "text/html; charset=UTF-8";
            response.Headers["Server"] = "ExampleServer";

            //发送响应
            response.Send();

        }
        public static void gameQueryStatus(HttpRequest request, HttpResponse response)
        {

        }
    }
}
